package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import javabean.JPanelImagen;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

import javax.swing.WindowConstants;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class JBienvenida extends javax.swing.JFrame {
	
	private JPanelImagen pnlImagenBienvenida;
	private JButton btnSalir;
	private JButton btnEmpezar;
	private JLabel lblBienvenida;
	private JMenuItem mnItemAvanzado;
	private JMenuItem mnItemIntermedio;
	private JMenuItem mnItemBasico;
	private JMenu jMenu1;
	private JMenuBar mnBarMenu;

	public JBienvenida() {
		super("******** MASTERMIND ********");
		initGUI();
		this.setLocationRelativeTo(null);
		this.setResizable(false);
	}	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				mnBarMenu = new JMenuBar();
				setJMenuBar(mnBarMenu);
				mnBarMenu.add(getMenuPrincipal());
			}
			{
			{
				pnlImagenBienvenida = new JPanelImagen();
				getContentPane().add(pnlImagenBienvenida, BorderLayout.CENTER);
				pnlImagenBienvenida.setRutaImagen("/imagenes/imagenfondo.png");
				pnlImagenBienvenida.setPreferredSize(new java.awt.Dimension(400, 217));
				
				
				{
					lblBienvenida = new JLabel();
					pnlImagenBienvenida.add(lblBienvenida);
					lblBienvenida.setText("Bienvenidos a MasterMind");
					lblBienvenida.setFont(new java.awt.Font("Bitstream Charter",0,25));
					lblBienvenida.setBounds(58, 42, 343, 44);
				}
				
				{
					btnEmpezar = new JButton();
					pnlImagenBienvenida.add(btnEmpezar);
					btnEmpezar.setText("Empezar");
					btnEmpezar.setBounds(85, 117, 90, 28);
					btnEmpezar.setActionCommand("Empezar");
				}
				{
					btnSalir = new JButton();
					pnlImagenBienvenida.add(btnSalir);
					btnSalir.setText("Salir");
					btnSalir.setBounds(222, 117, 100, 27);
					btnSalir.setActionCommand("Salir");
				}
				
			}
		}
			pack();
			this.setSize(453, 245);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public void AddListener(ActionListener actionListener){
		btnEmpezar.addActionListener(actionListener);
		btnSalir.addActionListener(actionListener);
		mnItemBasico.addActionListener(actionListener);
		mnItemIntermedio.addActionListener(actionListener);
		mnItemAvanzado.addActionListener(actionListener);
	}
	
	public ComboBoxModel ModeloCombo(){
		ComboBoxModel JCmbNivelModel;
		JCmbNivelModel = new DefaultComboBoxModel(
						 new String[] { "Seleccione Nivel", "Basico", "Intermedio", "Avanzado"});
		return JCmbNivelModel;
	}
	
	private JMenu getMenuPrincipal(){
		if(jMenu1 == null) {
			jMenu1 = new JMenu();
			jMenu1.setText("Consultar");
			jMenu1.add(getMnItemBasico());
			jMenu1.add(getMnItemIntermedio());
			jMenu1.add(getMnItemAvanzado());
		}
		return jMenu1;
	}
	
	private JMenuItem getMnItemBasico() {
		if(mnItemBasico == null) {
			mnItemBasico = new JMenuItem();
			mnItemBasico.setText("Nivel Basico");
		}
		return mnItemBasico;
	}
	
	private JMenuItem getMnItemIntermedio() {
		if(mnItemIntermedio == null) {
			mnItemIntermedio = new JMenuItem();
			mnItemIntermedio.setText("Nivel Intermedio");
		}
		return mnItemIntermedio;
	}
	
	private JMenuItem getMnItemAvanzado() {
		if(mnItemAvanzado == null) {
			mnItemAvanzado = new JMenuItem();
			mnItemAvanzado.setText("Nivel Avanzado");
		}
		return mnItemAvanzado;
	}

}